Ad Widget

Collapse

zabcon: `addr_port': undefined method `+' for nil:NilClass (NoMethodError)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • fascinatedcow
    Junior Member
    • Mar 2010
    • 20

    #1

    zabcon: `addr_port': undefined method `+' for nil:NilClass (NoMethodError)

    Hello,

    Has anyone seen this? I am not too experienced with Ruby and have no idea what any of this means but it's broken like so for me:

    Code:
    ./zabcon -d8
    i486-linux
    D8 ./libs/command_help.rb:method:63 CommandHelp.method overload
    D8 ./libs/command_help.rb:method:64 Arg: :language=
    D8 ./libs/command_help.rb:method:76 returning: #<Method: CommandHelp#language=>
    Welcome to Zabcon.
    Use the command 'help' to get help on commands
    D8 ./libs/command_help.rb:method:63 CommandHelp.method overload
    D8 ./libs/command_help.rb:method:64 Arg: :add_host
    D8 ./libs/command_help.rb:method:76 returning: #<Proc:0xb755faac@./libs/command_help.rb:70>
    D8 ./libs/command_help.rb:method:63 CommandHelp.method overload
    D8 ./libs/command_help.rb:method:64 Arg: :add_user
    D8 ./libs/command_help.rb:method:76 returning: #<Proc:0xb755faac@./libs/command_help.rb:70>
    D8 ./libs/command_help.rb:method:63 CommandHelp.method overload
    D8 ./libs/command_help.rb:method:64 Arg: :get_user
    D8 ./libs/command_help.rb:method:76 returning: #<Proc:0xb755faac@./libs/command_help.rb:70>
    D8 ./libs/command_help.rb:method:63 CommandHelp.method overload
    D8 ./libs/command_help.rb:method:64 Arg: :delete_user
    D8 ./libs/command_help.rb:method:76 returning: #<Proc:0xb755faac@./libs/command_help.rb:70>
    D8 ./libs/command_help.rb:method:63 CommandHelp.method overload
    D8 ./libs/command_help.rb:method:64 Arg: :delete_host
    D8 ./libs/command_help.rb:method:76 returning: #<Proc:0xb755faac@./libs/command_help.rb:70>
     -> login foo bar blah
    D6 ./zabcon:start:207 Input from user: login foo bar blah
    D7 ./libs/command_tree.rb:parse:86 Parsing: login foo bar blah
    D7 ./libs/command_tree.rb:parse:88 User Variables: {}
    D7 ./libs/command_tree.rb:search:58 Searching: login foo bar blah
    D7 ./libs/command_tree.rb:search:65 search result: #<CommandTree:0x-2456f6e6 @command="login", @commandproc=#<Method: ZabconCore#do_login>, @helpproc=nil, @argument_processor=#<Proc:0xb7579970@./libs/command_tree.rb:164>, @arguments=nil, @options={:suppress_printer=>true}, @depth=1, @children=[]>
    D6 ./libs/command_tree.rb:parse:96 calling argument processor: foo bar blah
    D4 ./libs/argument_processor.rb:login:597 args: foo bar blah
    D6 ./libs/command_tree.rb:parse:98 received from argument processor: {:api_params=>{:server=>"foo", :username=>"bar", :password=>"blah"}}
    D6 ./zabcon:start:213 Results from parse: {:api_params=>{:server=>"foo", :username=>"bar", :password=>"blah"}, :proc=>#<Method: ZabconCore#do_login>, :options=>{:suppress_printer=>true}, :helpproc=>nil}
    D4 ./zabcon:start:223 Calling function: {:api_params=>{:server=>"foo", :username=>"bar", :password=>"blah"}, :proc=>#<Method: ZabconCore#do_login>, :options=>{:suppress_printer=>true}, :helpproc=>nil}
    D6 ./zabbixapi.rb:initialize:139 protocol: , host: 
    D6 ./zabbixapi.rb:initialize:140 port: , path: foo/api_jsonrpc.php
    D6 ./zabbixapi.rb:initialize:141 query: , fragment: 
    D8 ./zabbixapi.rb:do_request:224 Sending: {"auth":null,"method":"user.authenticate","id":0,"params":{"password":"blah","user":"bar"},"jsonrpc":"2.0"}
    /usr/lib/ruby/1.8/net/http.rb:1116:in `addr_port': undefined method `+' for nil:NilClass (NoMethodError)
            from /usr/lib/ruby/1.8/net/http.rb:1076:in `begin_transport'
            from /usr/lib/ruby/1.8/net/http.rb:1047:in `request'
            from ./zabbixapi.rb:226:in `do_request'
            from /usr/lib/ruby/1.8/net/http.rb:543:in `start'
            from ./zabbixapi.rb:220:in `do_request'
            from ./zabbixapi.rb:173:in `login'
            from ./libs/zbxcliserver.rb:41:in `initialize'
            from ./zabcon:414:in `new'
            from ./zabcon:414:in `do_login'
            from ./zabcon:224:in `call'
            from ./zabcon:224:in `start'
            from ./zabcon:770:in `run'
            from ./zabcon:779
    I get the same thing if I insert valid host, username and password. Would love to see this working. Any ideas appreciated.


    Thanks,

    Matt
  • fascinatedcow
    Junior Member
    • Mar 2010
    • 20

    #2
    Got a bit further:

    Code:
    ./zabcon -d8
    i486-linux
    D8 ./libs/command_help.rb:method:63 CommandHelp.method overload
    D8 ./libs/command_help.rb:method:64 Arg: :language=
    D8 ./libs/command_help.rb:method:76 returning: #<Method: CommandHelp#language=>
    Welcome to Zabcon.
    Use the command 'help' to get help on commands
    D8 ./libs/command_help.rb:method:63 CommandHelp.method overload
    D8 ./libs/command_help.rb:method:64 Arg: :add_host
    D8 ./libs/command_help.rb:method:76 returning: #<Proc:0xb75adb1c@./libs/command_help.rb:70>
    D8 ./libs/command_help.rb:method:63 CommandHelp.method overload
    D8 ./libs/command_help.rb:method:64 Arg: :add_user
    D8 ./libs/command_help.rb:method:76 returning: #<Proc:0xb75adb1c@./libs/command_help.rb:70>
    D8 ./libs/command_help.rb:method:63 CommandHelp.method overload
    D8 ./libs/command_help.rb:method:64 Arg: :get_user
    D8 ./libs/command_help.rb:method:76 returning: #<Proc:0xb75adb1c@./libs/command_help.rb:70>
    D8 ./libs/command_help.rb:method:63 CommandHelp.method overload
    D8 ./libs/command_help.rb:method:64 Arg: :delete_user
    D8 ./libs/command_help.rb:method:76 returning: #<Proc:0xb75adb1c@./libs/command_help.rb:70>
    D8 ./libs/command_help.rb:method:63 CommandHelp.method overload
    D8 ./libs/command_help.rb:method:64 Arg: :delete_host
    D8 ./libs/command_help.rb:method:76 returning: #<Proc:0xb75adb1c@./libs/command_help.rb:70>
     -> login https://localhost blah blah
    D6 ./zabcon:start:207 Input from user: login https://localhost blah blah
    D7 ./libs/command_tree.rb:parse:86 Parsing: login https://localhost blah blah
    D7 ./libs/command_tree.rb:parse:88 User Variables: {}
    D7 ./libs/command_tree.rb:search:58 Searching: login https://localhost blah blah
    D7 ./libs/command_tree.rb:search:65 search result: #<CommandTree:0x-245486ae @command="login", @commandproc=#<Method: ZabconCore#do_login>, @helpproc=nil, @argument_processor=#<Proc:0xb75c79e0@./libs/command_tree.rb:164>, @arguments=nil, @options={:suppress_printer=>true}, @depth=1, @children=[]>
    D6 ./libs/command_tree.rb:parse:96 calling argument processor: https://localhost blah blah
    D4 ./libs/argument_processor.rb:login:597 args: https://localhost blah blah
    D6 ./libs/command_tree.rb:parse:98 received from argument processor: {:api_params=>{:server=>"https://localhost", :username=>"blah", :password=>"blah"}}
    D6 ./zabcon:start:213 Results from parse: {:api_params=>{:server=>"https://localhost", :username=>"blah", :password=>"blah"}, :proc=>#<Method: ZabconCore#do_login>, :options=>{:suppress_printer=>true}, :helpproc=>nil}
    D4 ./zabcon:start:223 Calling function: {:api_params=>{:server=>"https://localhost", :username=>"blah", :password=>"blah"}, :proc=>#<Method: ZabconCore#do_login>, :options=>{:suppress_printer=>true}, :helpproc=>nil}
    D6 ./zabbixapi.rb:initialize:139 protocol: https, host: localhost
    D6 ./zabbixapi.rb:initialize:140 port: 443, path: /api_jsonrpc.php
    D6 ./zabbixapi.rb:initialize:141 query: , fragment: 
    D8 ./zabbixapi.rb:do_request:224 Sending: {"auth":null,"method":"user.authenticate","id":0,"params":{"password":"blah","user":"blah"},"jsonrpc":"2.0"}
    /usr/lib/ruby/1.8/net/http.rb:2026:in `read_status_line': wrong status line: "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">" (Net::HTTPBadResponse)
            from /usr/lib/ruby/1.8/net/http.rb:2013:in `read_new'
            from /usr/lib/ruby/1.8/net/http.rb:1050:in `request'
            from ./zabbixapi.rb:226:in `do_request'
            from /usr/lib/ruby/1.8/net/http.rb:543:in `start'
            from ./zabbixapi.rb:220:in `do_request'
            from ./zabbixapi.rb:173:in `login'
            from ./libs/zbxcliserver.rb:41:in `initialize'
            from ./zabcon:414:in `new'
            from ./zabcon:414:in `do_login'
            from ./zabcon:224:in `call'
            from ./zabcon:224:in `start'
            from ./zabcon:770:in `run'
            from ./zabcon:779
    Looks like url must be https://...

    Is this even the right place to ask about this?

    Comment

    • nelsonab
      Senior Member
      Zabbix Certified SpecialistZabbix Certified Professional
      • Sep 2006
      • 1233

      #3
      I just did a quick hack to allow for https which I'll polish up a bit and check in here in a little bit. Can you also post part of your config file, does your zabbix server require https?

      I'm sure this will be great news to Richlv and others :-)
      RHCE, author of zbxapi
      Ansible, the missing piece (Zabconf 2017): https://www.youtube.com/watch?v=R5T9NidjjDE
      Zabbix and SNMP on Linux (Zabconf 2015): https://www.youtube.com/watch?v=98PEHpLFVHM

      Comment

      • nelsonab
        Senior Member
        Zabbix Certified SpecialistZabbix Certified Professional
        • Sep 2006
        • 1233

        #4
        Changed checked in.
        RHCE, author of zbxapi
        Ansible, the missing piece (Zabconf 2017): https://www.youtube.com/watch?v=R5T9NidjjDE
        Zabbix and SNMP on Linux (Zabconf 2015): https://www.youtube.com/watch?v=98PEHpLFVHM

        Comment

        • fascinatedcow
          Junior Member
          • Mar 2010
          • 20

          #5
          Hello nelsonab,

          Thanks for your reply and sorry for not replying sooner.

          Not sure if you still need this, but my config is like this:

          Code:
          server=https://localhost
          username=<username>
          password=<password>
          lines=24
          debug=0
          language=english
          The reason for connecting to localhost is that we have http auth on the real zabbix node, so I am proxying to inserting the authorization header.

          I have managed to connect successfully like this so thanks very much


          Matt

          Comment

          • nelsonab
            Senior Member
            Zabbix Certified SpecialistZabbix Certified Professional
            • Sep 2006
            • 1233

            #6
            np, glad to hear it's working for you. If you have any features you would like to see prioritised please let me know or open a ticket on http://trac.red-tux.net and I'll work to get it rolled into the next release. I'm presently about 3 bugs from a 0.1 release.
            RHCE, author of zbxapi
            Ansible, the missing piece (Zabconf 2017): https://www.youtube.com/watch?v=R5T9NidjjDE
            Zabbix and SNMP on Linux (Zabconf 2015): https://www.youtube.com/watch?v=98PEHpLFVHM

            Comment

            Working...